package com.designMode.prototype;

import java.util.ArrayList;

/**
 * 抽象原型类
 */
public abstract class Prototype implements Cloneable {

    protected ArrayList<String> arrayList = new ArrayList<>();

    public void addValue(String value) {
        this.arrayList.add(value);
    }

    public ArrayList<String> getValue() {
        return this.arrayList;
    }

    @Override
    public Prototype clone() {
        System.out.println("Prototype->clone()");
        Prototype prototypeClass = null;
        try {
            prototypeClass = (Prototype) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return prototypeClass;
    }
}
